<template>
    <div class="buttons">
        <button class="button__success">Success</button>
        <button class="button__info">Info</button>
        <button class="button__warning">Warning</button>
        <button class="button__error">Error</button>
    </div>

</template>

<script>
export default {
    mounted() {
        const swal = inject("$swal");
        swal.fire({
            title: "hello",
            position: 'bottom-end',
            timer: 2000,
        });
    }
}
</script>

<style scoped lang="scss">
$success_color: #CDFFA7;
$info_color: #A7FFE4;
$warning_color: #FFFAA7;
$error_color: #FFA7A7;

.toast {
    position: fixed;
    top: 0;
    right: 0;
}

.toast__message {
    position: relative;
    width: 300px;
    min-height: 50px;
    border-radius: 5px;
    border: 1px solid;
    margin-top: 10px;
    margin-right: 10px;
    padding: 0.4em 0.5em;
    font-size: 14px;
    font-family: Roboto, Arial, sans-serif;
    line-height: 1.25;
    box-shadow: 1px 1px 4px gray;
    transition: all 0.3s ease;
}

.toast__message-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 0.4em;
}

.toast__message-cross-icon {
    position: absolute;
    top: 0;
    right: 0.5em;
    width: 0.8em;
    height: 0.8em;
    padding-top: inherit;
    transform: translateY(10%);
    cursor: pointer;
}

.toast__message--hidden {
    transform: translateX(50%);
    opacity: 0;
}

.toast__message--success {
    $color: $success_color;
    $color_darken: darken($color, 50%);
    background: $color;
    border-color: darken($color, 50%);
    color: darken($color, 70%);

    .toast__message-cross-icon {
        color: darken($color, 60%);
    }
}

.toast__message--info {
    $color: $info_color;
    background: $color;
    border-color: darken($color, 50%);
    color: darken($color, 70%);

    .toast__message-cross-icon {
        color: darken($color, 60%);
    }
}

.toast__message--warning {
    $color: $warning_color;
    background: $color;
    border-color: darken($color, 50%);
    color: darken($color, 70%);

    .toast__message-cross-icon {
        color: darken($color, 60%);
    }
}

.toast__message--error {
    $color: $error_color;
    background: $color;
    border-color: darken($color, 50%);
    color: darken($color, 60%);

    .toast__message-cross-icon {
        color: darken($color, 50%);
    }
}



.buttons {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

button {
    font-size: 16px;
    font-family: Roboto, Arial, sans-serif;
    border-radius: 5px;
    padding: 0.2em 0.6em;
    color: #fff;
}

button:not(:last-of-type) {
    margin-right: 0.4em;
}

.button__success {
    $color: $success_color;
    background: darken($color, 50%);
    border-bottom-color: darken($color, 50%);
    border-right-color: darken($color, 50%);
    border-left-color: darken($color, 47%);
    border-top-color: darken($color, 47%);
}

.button__info {
    $color: $info_color;
    background: darken($color, 50%);
    border-bottom-color: darken($color, 50%);
    border-right-color: darken($color, 50%);
    border-left-color: darken($color, 47%);
    border-top-color: darken($color, 47%);
}

.button__warning {
    $color: $warning_color;
    background: darken($color, 42%);
    border-bottom-color: darken($color, 42%);
    border-right-color: darken($color, 42%);
    border-left-color: darken($color, 40%);
    border-top-color: darken($color, 40%);
}

.button__error {
    $color: $error_color;
    background: darken($color, 46%);
    border-bottom-color: darken($color, 46%);
    border-right-color: darken($color, 46%);
    border-left-color: darken($color, 44%);
    border-top-color: darken($color, 44%);
}
</style>